<?php

$zip = new \ZipArchive();
$dir = './Public/Zip/';
$filename = date('Ymd') . '.zip';

if ($fh = opendir($dir)) {
    while (false !== ($file = readdir($fh))) {
        if ($file != "." && $file != "..") {
            //echo $dir.$file,'<br/>';
            if ($file != $filename) {
                @unlink($dir . $file);
                fopen($dir . $filename, 'w');
                if ($zip->open($dir . $filename, \ZipArchive::OVERWRITE) === true) {
                    addFileToZip('e:/YOGOA/data5/OA/', $zip);
                    $zip->close();
                }
            }
        }
    }
    closedir($fh);
}